package edu.ynmd.class2.database.action;

import edu.ynmd.class2.database.dao.StudentDao;
import edu.ynmd.class2.database.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.Timestamp;

@Controller
public class PublicAction {

    @Autowired
    private StudentDao studentDao;

    @GetMapping("testDao")
    @ResponseBody
    public boolean testDao() throws Exception {
        //Student student=new Student();
        //student.setStunum("201621447245");
        //student.setName("周艺");
        //student.setSex("F");
       // student.setBirthday(new Timestamp(System.currentTimeMillis()));
        //student.setNativeplace("云南昆明");
        //studentDao.save(student);

        //studentDao.save(student);
        //Student student=new Student();
       // student.setStunum("201621447246");
        //student.setName("姓名修改");
        //student.setStudentid("6c09f3bd-bac0-4248-a090-22806da4a430");
        //studentDao.save(student);

        //Student student=studentDao.findOne("6c09f3bd-bac0-4248-a090-22806da4a430");
        //student.setSex("M");
        //student.setBirthday(new Timestamp(System.currentTimeMillis()));
        //student.setNativeplace("红塔区");
        //studentDao.save(student);

        Student student=new Student();
        student.setStudentid("6c09f3bd-bac0-4248-a090-22806da4a430");
        studentDao.delete(student);

        return true;

    }




}
